package org.meluk.billboard.jpa;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.meluk.billboard.jpa.seabattle.SBGame;

@Entity
public class Player implements Serializable {

    public Player() {
    }

    public Player(Boolean isComputer, User user) {
        this.isComputer = isComputer;
        this.user = user;
    }
    private static long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private Boolean isComputer;
    @OneToOne
    @JoinColumn(name = "user_id")
    private User user;
    @OneToMany(mappedBy = "player")
    private List<StatisticPlayer> statisticPlayerList = new ArrayList<StatisticPlayer>();
    @ManyToMany(mappedBy = "players")
    private List<SBGame> sbGames = new ArrayList<SBGame>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Boolean getIsComputer() {
        return isComputer;
    }

    public void setIsComputer(Boolean isComputer) {
        this.isComputer = isComputer;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public List<StatisticPlayer> getStatisticPlayerList() {
        return statisticPlayerList;
    }

    public void setStatisticPlayerList(List<StatisticPlayer> statisticPlayerList) {
        this.statisticPlayerList = statisticPlayerList;
    }

    public List<SBGame> getSbGames() {
        return sbGames;
    }
}
